//-----------------------------------------------------------------------

// <copyright file="CommandButtonFieldDefinition.cs" company="Jamie Knight">

// Copyright (c) Jamie Knight. All rights reserved.

// </copyright>

//-----------------------------------------------------------------------

using System;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Input;

namespace DevKnightlie.WPF.AutoForm.FieldDefinitions
{
    public class CommandButtonFieldDefinition:BaseFieldDefinition
    {
        private ICommand _command;
        #region Private Fields

        #endregion

        #region Properties

        public ICommand Command
        {
            get { return _command; }
            set { _command = value; }
        }

        #endregion

        public override void BuildLabelControl()
        {
            LabelControl = null;
        }


        public override void BuildInputControl()
        {
            Button button = new Button()
            {
                Content = Title,
                Command = Command
            };
            SetupEnabledBinding(button);
            ContainerControl = InputControl = button;            
        }

    }
}
